<?php
    $title = 'บริษัท แบคอัพ คอมมิวนิเคชั่นส์ แอนด์ เซอร์วิสเซส จำกัด';
    include('header.php');
    
    $sql = "SELECT * FROM home_slide WHERE hs_active=1 ORDER BY hs_position";
    $result = $db->Execute($sql);
    $i = 1;
    $home_slide = '';
    while (!$result->EOF)
    {
        if(img_exists(APPPATH.'/images/home_slide',$result->fields['hs_path'])){
            $home_slide .= '<img src="'.SITEURL.'/images/home_slide/'.$result->fields['hs_path'].'" />';
        }
        $result->MoveNext();
    }
    $result->Close();
    
    $sql = "SELECT * FROM featured_project WHERE fp_active=1 ORDER BY fp_position";
    $result = $db->Execute($sql);
    $i = 1;
    $featured_project = '';
    while (!$result->EOF)
    {
        if(img_exists(APPPATH.'/images/featured_project',$result->fields['fp_path'])){
            $featured_project .= '<img src="'.SITEURL.'/images/featured_project/'.$result->fields['fp_path'].'" />';
        }
        $result->MoveNext();
    }
    $result->Close();
?>
            <div id="home_top_slide">
		<?php echo $home_slide; ?>
		<?php echo $home_slide; ?>
		<?php echo $home_slide; ?>
		<?php echo $home_slide; ?>
		<div class="clear">&nbsp;</div>
            </div>
	    <div class="clear">&nbsp;</div>
	    <div class="home_block_line">&nbsp;</div>
	    
	    <div id="home_block_slide_prev_bt">
		<img src="images/prev.jpg" alt="Next" id="home_block_slide_prev" class="img_link" />
	    </div>
	    <div id="home_block_slide_x">
		<div id="home_block_slide">
		    <ul>
			<li class="first">
			    <h3><?php echo _l('Corporate & Brand Identity'); ?></h3>
			    <img src="images/media/1.jpg" alt="<?php echo _l('Corporate & Brand Identity'); ?>" />
			    <p class="detail">
				<?php echo _l('home-block-1'); ?>
			    </p>
			    <p class="read_more">
				<a href="strategic-communications.php" title="<?php echo _l('Corporate & Brand Identity'); ?>">more</a>
			    </p>
			</li>
			<li>
			    <h3><?php echo _l('Annual Report'); ?></h3>
			    <img src="images/media/2.jpg" alt="<?php echo _l('Annual Report'); ?>" />
			    <p class="detail">
				<?php echo _l('home-block-2'); ?>
			    </p>
			    <p class="read_more">
				<a href="media-communication.php?m_id=5" title="<?php echo _l('Annual Report'); ?>">more</a>
			    </p>
			</li>
			<li class="last">
			    <h3><?php echo _l('Software Development'); ?></h3>
			    <img src="images/media/3.jpg" alt="<?php echo _l('Software Development'); ?>" />
			    <p class="detail">
			       <?php echo _l('home-block-3'); ?>
			    </p>
			    <p class="read_more">
				<a href="business-applications.php" title="<?php echo _l('Software Development'); ?>">more</a>
			    </p>
			</li>
			
			
			<li class="first">
			    <h3><?php echo _l('Web Development'); ?></h3>
			    <img src="images/media/4.jpg" alt="<?php echo _l('Web Development'); ?>" />
			    <p class="detail">
				<?php echo _l('home-block-4'); ?>
			    </p>
			    <p class="read_more">
				<a href="media-communication.php?m_id=1" title="<?php echo _l('Web Development'); ?>">more</a>
			    </p>
			</li>
			<li>
			    <h3><?php echo _l('Interactive Presentation'); ?></h3>
			    <img src="images/media/5.jpg" alt="<?php echo _l('Interactive Presentation'); ?>" />
			    <p class="detail">
			       <?php echo _l('home-block-5'); ?>
			    </p>
			    <p class="read_more">
				<a href="media-communication.php?m_id=2" title="<?php echo _l('Interactive Presentation'); ?>">more</a>
			    </p>
			</li>
			<li>
			    <h3><?php echo _l('Video Presentation'); ?></h3>
			    <img src="images/media/6.jpg" alt="<?php echo _l('Video Presentation'); ?>" />
			    <p class="detail">
				<?php echo _l('home-block-6'); ?>
			    </p>
			    <p class="read_more">
				<a href="media-communication.php?m_id=3" title="<?php echo _l('Video Presentation'); ?>">more</a>
			    </p>
			</li>
			
			<li class="first">
			    <h3><?php echo _l('Mobile Application'); ?></h3>
			    <img src="images/media/7.jpg" alt="<?php echo _l('Mobile Application'); ?>" />
			    <p class="detail">
				<?php echo _l('home-block-7'); ?>
			    </p>
			    <p class="read_more">
				<a href="business-applications.php" title="<?php echo _l('Mobile Application'); ?>">more</a>
			    </p>
			</li>
			<li>
			    <h3><?php echo _l('Printing Service'); ?></h3>
			    <img src="images/media/8.jpg" alt="<?php echo _l('Printing Service'); ?>" />
			    <p class="detail">
				<?php echo _l('home-block-8'); ?>
			    </p>
			    <p class="read_more">
				<a href="media-communication.php?m_id=6" title="<?php echo _l('Printing Service'); ?>">more</a>
			    </p>
			</li>
			<li class="last">
			    <h3><?php echo _l('CD/DVD Production'); ?></h3>
			    <img src="images/media/9.jpg" alt="<?php echo _l('CD/DVD Production'); ?>" />
			    <p class="detail">
				<?php echo _l('home-block-8'); ?>
			    </p>
			    <p class="read_more">
				<a href="media-communication.php?m_id=9" title="<?php echo _l('CD/DVD Production'); ?>">more</a>
			    </p>
			</li>
			
		    </ul>
		</div>
	    </div>
	    <div id="home_block_slide_next_bt">
		<img src="images/next.jpg" alt="Next" id="home_block_slide_next" class="img_link" />
	    </div>
	    <div class="clear">&nbsp;</div>
	    
	    <div class="home_block_line" id="home_block_line_2">&nbsp;</div>
	    
	    <div id="home_how_we_work">
		<h3>Who we are and how we work</h3>
		<p class="detail">
		    <?php echo _l('home_how_we_work'); ?>
		</p>
		<p class="read_more"><a href="about-us.php" title="About Us">more</a></p>
	    </div>
	    <div id="home_feature_project">
		<h3>Featured  Projects</h3>
		<div id="home_feature_project_slide">
		    <?php echo $featured_project; ?>
		</div>
	    </div>
	    <div class="clear">&nbsp;</div>
<?php
    include('footer.php');
?> 
<script type="text/javascript" src="js/jquery.cycle.all.js"></script>
<script type="text/javascript" src="js/jquery.jcarousel.min.js"></script>
<script>
    $(document).ready(function(){
	$('#home_top_slide').cycle();
	
	$('#home_feature_project_slide').cycle();
	
	$("#home_block_slide").jcarousel({
	    scroll: 3,
	    wrap: 'circular',
	    animation : 1200,
	    initCallback: mycarousel_initCallback,
	    buttonNextHTML: null,
	    buttonPrevHTML: null
	});
    });
    
    function mycarousel_initCallback(carousel) {
	jQuery('#home_block_slide_next').bind('click', function() {
	    carousel.next();
	    return false;
	});
    
	jQuery('#home_block_slide_prev').bind('click', function() {
	    carousel.prev();
	    return false;
	});
	
	jQuery('#home_block_slide').live('mouseenter', function() {
	    //carousel.stop();
	});
    };
</script>